package com.fiap.activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.fiap.functions.UserFunctions;
import com.fiap.service.SocialService;

public class MainMenuActivity extends Activity {
	
	
	private Button btnLogout;
	
	UserFunctions userFunctions;
	
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
//        userFunctions = new UserFunctions();
//        if(userFunctions.isUserLoggedIn(getApplicationContext())){
        	
        	SocialService.init(getApplicationContext());
        	
            setContentView(R.layout.main_menu);
            
            prepareScreen();
            
            btnLogout.setOnClickListener(new View.OnClickListener() {
                
                public void onClick(View arg0) {
//                    userFunctions.logoutUser(getApplicationContext());
                    Intent login = new Intent(getApplicationContext(), LoginActivity.class);
                    login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    startActivity(login);
                    // Closing menu screen
                    finish();
                }
            });
            
//        }else{
//            Intent login = new Intent(getApplicationContext(), LoginActivity.class);
//            login.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//            startActivity(login);
//            // Closing dashboard screen
//            finish();
//        }
        
    }


	private void prepareScreen() {
		btnLogout = (Button) findViewById(R.id.btnLogout);
	}
	
	public void activitiesGps (View v) {
    	Intent i = new Intent(getApplicationContext(), GPSActivity.class);
		startActivity(i);
    }
	
	public void activitiesInitialInfo (View v) {
		Intent i = new Intent(getApplicationContext(), InitialInfoActivity.class);
        // Close all views before launching
        //i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(i);
//        finish();
    }
	
    
}